<?php
/* @var $this DatabasesController */
/* @var $dataProvider CActiveDataProvider */

$this->breadcrumbs=array(
	'Databases',
);

$this->menu=array(
	array('label'=>'Create Databases', 'url'=>array('create')),
	array('label'=>'Manage Databases', 'url'=>array('admin')),
);
?>

<h1>Databases</h1>

<?php $this->widget('zii.widgets.CListView', array(
	'dataProvider'=>$dataProvider,
	'itemView'=>'_view',
)); ?>



<script>
$().ready(function(e){

	$(".changeStatus").live('click',function(e){
	
		var status = $(this).attr('status');
		var uuid = $(this).attr('uuid');
		var  _status = 0;
		if(status == "Missing"){
			$(this).html('Actived');
			$(this).attr('status','Actived');
			$(this).parent().css({background:"green"});
			_status = 0;
		}else{
			$(this).html('Missing');
			$(this).attr('status','Missing');
			$(this).parent().css({background:"red"});
			_status = 1;
		}
		
		$.get("<?php echo Yii::app()->createUrl('/databases/status?id=');?>"+uuid+"&status="+_status,function(res){
		
		});
		return false;
		console.log(_status);
	});
});
</script>